<div class="form">
    <?php Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . "/js/jquery.number_format.js", CClientScript::POS_END); ?>
    <form method="post" action="">
	<?php echo $this->renderFlash(); ?>
        
        <div style="height: 500px">      
            <ul style="list-style-type: none">
            <?php
                foreach ($materialList as $material => $value):
                    echo CHtml::openTag('li', array('style' => 'width: 500px; float:left; line-height: 10px; margin: 5px'));  
            ?>
                <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                    <?php
                        echo CHtml::openTag('th', array('valign' => 'top', 'style' => 'width: 200px'));                       
                            echo $value->materialname;
                        echo CHtml::closeTag('th');
                        echo CHtml::openTag('td');
                            echo CHtml::textField('MaterialRequestDetail[quantity]['.$value->materialid.']', '0', array(
                                'class' => 'inp-form',
                                'onfocus' => '$(this).select()',
                                'onkeyup' => '
                                    var format_number = $().number_format($(this).val().replace(/\s/g, ""), {
                                        numberOfDecimals:0,
                                        decimalSeparator: ",",
                                        thousandSeparator: " "
                                    });

                                    $(this).val(format_number);
                                ',
                            ));
                        echo CHtml::closeTag('td');
                    ?>
                </table>
            <?php
                    echo CHtml::closeTag('li');
                endforeach;
            ?>
            </ul>            
        </div>
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class' => 'form-submit')); ?>
    </form>
</div><!-- form -->